import React from 'react'
import {bindActionCreators} from'redux'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import MatchButton from '../components/MatchButton'
import * as TodoActions from '../actions';

const Match = ({login,match,actions}) =>(
    <div>
        <MatchButton inf = {login} matchState = {match} matchStart = {actions.matchStart} reset={actions.matchStateReset}/>
    </div>
)

Match.propTypes = {
    match:PropTypes.object.isRequired
}

const mapStateToProps = state => {
    return{
    login:state.login,//获取账号UID
    match:state.match//获取match状态
}}


const mapDispatchToProps = dispatch => { 
    return {actions:bindActionCreators(TodoActions, dispatch)}
}

export default connect(mapStateToProps,mapDispatchToProps)(Match)